package com.pacy.pacybaseproject.adapters;

import android.graphics.Color;
import android.util.TypedValue;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.fondesa.recyclerviewdivider.DividerBuilder;
import com.pacy.pacybaseproject.R;
import com.pacy.pacybaseproject.beans.BusStationBean;
import com.pacy.pacybaseproject.utils.Constants;

/**
 * @author PACY
 * @date 2024/1/3
 * description:多余的
 */
public class BusStationAdapter extends BaseQuickAdapter<BusStationBean, BaseViewHolder> {
    private BusStationChaildAdapter chaildAdapter;
    private RecyclerView recyclerView;
    public BusStationAdapter() {
        super(R.layout.bus_station_item_view);
    }

    @Override
    protected void convert(BaseViewHolder holder, BusStationBean s) {

        holder.setText(R.id.stationName_tv,s.getName()).setText(R.id.lenth_tv,s.getLenth()+"米");

        recyclerView=holder.getView(R.id.recyclerView);
        chaildAdapter=new BusStationChaildAdapter();
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.setAdapter(chaildAdapter);
        chaildAdapter.setNewInstance(s.getStation());

        if (recyclerView.getItemDecorationCount() == 0) {
            new DividerBuilder(getContext())
                    .size(8, TypedValue.COMPLEX_UNIT_DIP)
                    .color(Color.TRANSPARENT)
                    .showFirstDivider()
                    .showLastDivider()
                    .build().addTo(recyclerView);
        }
    }
}
